﻿using System.IO;

namespace Batman.Core.Utils
{
    public class StreamUtil
    {
        public static Stream ToStream(string str)
        {
            var bytes = System.Text.Encoding.UTF8.GetBytes(str);
            return new MemoryStream(bytes);
        }

        public static Stream ToStream<T>(T obj)
        {
            var str = JsonUtil.Serialize(obj);
            return ToStream(str);
        }
    }
}
